1 module features.dmd; 2 3 import commons; 4 import feature; 5 6 bool installDmd( 7 ref Terminal t, 8 ref RealTimeConsoleInput input, 9 TargetVersion ver, 10 Download[] downloads 11 ) 12 { 13 import std.system; 14 import std.path; 15 16 string sys; 17 version(X86_64) 18 string bin = "bin64"; 19 else 20 string bin = "bin"; 21 switch(os) with(OS) 22 { 23 case osx: sys = "osx"; break; 24 case win32, win64: sys = "windows"; break; 25 case linux: sys = "linux"; break; 26 default: assert(false, "System not supported."); 27 } 28 string binPath = buildNormalizedPath(downloads[0].getOutputPath, "dmd2", sys, bin); 29 makeFileExecutable(buildNormalizedPath(binPath, "dmd")); 30 makeFileExecutable(buildNormalizedPath(binPath, "dub")); 31 makeFileExecutable(buildNormalizedPath(binPath, "rdmd")); 32 33 configs["dmdVersion"] = ver.toString; 34 configs["dmdPath"] = buildNormalizedPath(std.file.getcwd, "D", "dmd2", sys, bin); 35 updateConfigFile(); 36 return true; 37 } 38 39 40 Feature DMDFeature; 41 void initialize() 42 { 43 DMDFeature = Feature( 44 "DMD", 45 "Digital Mars D Compiler. Used for fast iteration development", 46 ExistenceChecker(["dmdPath"]), 47 Installation([Download( 48 DownloadURL( 49 windows: "https://downloads.dlang.org/releases/2.x/$VERSION/dmd.$VERSION.windows.7z", 50 linux: "https://downloads.dlang.org/releases/2.x/$VERSION/dmd.$VERSION.linux.tar.xz", 51 osx: "https://downloads.dlang.org/releases/2.x/$VERSION/dmd.$VERSION.osx.tar.xz", 52 ), 53 outputPath: "$TEMP/$NAME", 54 )], toDelegate(&installDmd), ["$CWD/D"]), 55 (ref Terminal t, string installPath) 56 { 57 addToPath(installPath.dirName); 58 }, 59 VersionRange.parse("2.105.0", "2.110.0") 60 ); 61 } 62 void start() 63 { 64 65 }